50. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2023-07-12 04:42:37 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

50.1 Files compared

#LocationFileLast Modified
1Porto v4.0.5/Theme Files/Porto Theme/app/code/Mageplaza/LayeredNavigation/view/frontend/web/js/viewlayer.js2023-02-06 09:30:07 +0000
2Porto v4.0.6/Theme Files/Porto Theme/app/code/Mageplaza/LayeredNavigation/view/frontend/web/js/viewlayer.js2023-07-02 08:50:01 +0000

50.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged8716
Changed530
Inserted23
Removed00

50.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

50.4 Active regular expressions

No regular expressions were active.

50.5 Comparison detail

1 /** 1 /**
2  * Mageplaza 2  * Mageplaza
3  * 3  *
4  * NOTICE OF LICENSE 4  * NOTICE OF LICENSE
5  * 5  *
6  * This source file is subject to the Mageplaza.com license sliderConfig is 6  * This source file is subject to the Mageplaza.com license sliderConfig is
7  * available through the world-wide-web at this URL: 7  * available through the world-wide-web at this URL:
8  * https://www.mageplaza.com/LICENSE.txt 8  * https://www.mageplaza.com/LICENSE.txt
9  * 9  *
10  * DISCLAIMER 10  * DISCLAIMER
11  * 11  *
12  * Do not edit or add to this file if you wish to upgrade this extension to newer 12  * Do not edit or add to this file if you wish to upgrade this extension to newer
13  * version in the future. 13  * version in the future.
14  * 14  *
15  * @category    Mageplaza 15  * @category    Mageplaza
16  * @package     Mageplaza_LayeredNavigation 16  * @package     Mageplaza_LayeredNavigation
17  * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/) 17  * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/)
18  * @license     https://www.mageplaza.com/LICENSE.txt 18  * @license     https://www.mageplaza.com/LICENSE.txt
19  */ 19  */
20  20 
21 define([ 21 define([
22     'jquery', 22     'jquery',
23     'Mageplaza_AjaxLayer/js/action/submit-filter', 23     'Mageplaza_AjaxLayer/js/action/submit-filter',
24     'Magento_Catalog/js/price-utils', 24     'Magento_Catalog/js/price-utils',
25     'accordion', 25     'accordion',
26     'productListToolbarForm', 26     'productListToolbarForm',
27     'jquery/jquery-ui' 27     'jquery/jquery-ui'
28 ], function ($, submitFilterAction, ultil) { 28 ], function ($, submitFilterAction, ultil) {
29     "use strict"; 29     "use strict";
30  30 
31     $.widget('mageplaza.layer', $.mage.accordion, { 31     $.widget('mageplaza.layer', $.mage.accordion, {
32         options: { 32         options: {
33             openedState: 'active', 33             openedState: 'active',
34             collapsible: true, 34             collapsible: true,
35             multipleCollapsible: true, 35             multipleCollapsible: true,
36             animate: 200, 36             animate: 200,
37             mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', 37             mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]',
38             collapsibleElement: '[data-role=ln_collapsible]', 38             collapsibleElement: '[data-role=ln_collapsible]',
39             header: '[data-role=ln_title]', 39             header: '[data-role=ln_title]',
40             content: '[data-role=ln_content]', 40             content: '[data-role=ln_content]',
41             isCustomerLoggedIn: false, 41             isCustomerLoggedIn: false,
42             isAjax: true, 42             isAjax: true,
43             params: [], 43             params: [],
44             active: [], 44             active: [],
    45             activeDesktop: [],
    46             activeMobile: [],
45             checkboxEl: 'input[type=checkbox], input[type=radio]', 47             checkboxEl: 'input[type=checkbox], input[type=radio]',
46             sliderElementPrefix: '#ln_slider_', 48             sliderElementPrefix: '#ln_slider_',
47             sliderTextElementPrefix: '#ln_slider_text_' 49             sliderTextElementPrefix: '#ln_slider_text_'
48         }, 50         },
49  51 
50         _create: function () { 52         _create: function () {
51             this.initActiveItems(); 53             this.initActiveItems();
52  54 
53             this._super(); 55             this._super();
54  56 
55             this.initProductListUrl(); 57             this.initProductListUrl();
56             this.initObserve(); 58             this.initObserve();
57             this.initSlider(); 59             this.initSlider();
58             this.initWishlistCompare(); 60             this.initWishlistCompare();
59             this.selectedAttr(); 61             this.selectedAttr();
60             this.renderCategoryTree(); 62             this.renderCategoryTree();
61         }, 63         },
62  64 
63         initActiveItems: function () { 65         initActiveItems: function () {
64             var layerActives = this.options.active, 66             var layerActivesDesktop = this.options.activeDesktop,
65                 actives = []; 67                 layerActivesMobile  = this.options.activeMobile,
    68                 activesDesktop = [],
    69                 activesMobile = [];
66             if ($(".page-layout-1column").length){ 70             if ($(".page-layout-1column").length){
67                 this.options.multipleCollapsible = false; 71                 this.options.multipleCollapsible = false;
68             } 72             }
69  73 
70             if (typeof window.layerActiveTabs !== 'undefined') { 74             if (typeof window.layerActiveTabs !== 'undefined') {
71                 layerActives = window.layerActiveTabs; 75                 layerActivesDesktop, layerActivesMobile = window.layerActiveTabs;
72             } 76             }
73             if (layerActives.length) { 77             if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
    78                 || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) {
    79                 if (layerActivesMobile.length) {
74                 this.element.find('.filter-options-item').each(function (index) { 80                     this.element.find('.filter-options-item').each(function (index) {
75                     if (~$.inArray($(this).attr('attribute')layerActives)) { 81                         if (~$.inArray($(this).attr('attribute')layerActivesMobile)) {
76                         actives.push(index); 82                             activesMobile.push(index);
77                     } 83                         }
78                 }); 84                     });
79             } 85                 }
80  86                 this.options.active = activesMobile;
81             this.options.active = actives; 87                 return this;
82  88             }else{
    89                 if (layerActivesDesktop.length) {
    90                     this.element.find('.filter-options-item').each(function (index) {
    91                         if (~$.inArray($(this).attr('attribute'), layerActivesDesktop)) {
    92                             activesDesktop.push(index);
    93                         }
    94                     });
    95                 }
    96                 this.options.active = activesDesktop;
83             return this; 97                 return this;
    98             }
84         }, 99         },
85  100 
86         initProductListUrl: function () { 101         initProductListUrl: function () {
87             var isProcessToolbar = false, 102             var isProcessToolbar = false,
88                 isAjax = this.options.isAjax; 103                 isAjax = this.options.isAjax;
89             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { 104             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) {
90                 if (isProcessToolbar) { 105                 if (isProcessToolbar) {
91                     return; 106                     return;
92                 } 107                 }
93                 if (isAjax) { 108                 if (isAjax) {
94                     isProcessToolbar = true; 109                     isProcessToolbar = true;
95                 } 110                 }
96  111 
97                 var urlPaths = this.options.url.split('?'), 112                 var urlPaths = this.options.url.split('?'),
98                     baseUrl = urlPaths[0], 113                     baseUrl = urlPaths[0],
99                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], 114                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [],
100                     paramData = {}, 115                     paramData = {},
101                     parameters; 116                     parameters;
102                 for (var i = 0; i < urlParams.length; i++) { 117                 for (var i = 0; i < urlParams.length; i++) {
103                     parameters = urlParams[i].split('='); 118                     parameters = urlParams[i].split('=');
104                     paramData[parameters[0]] = parameters[1] !== undefined 119                     paramData[parameters[0]] = parameters[1] !== undefined
105                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) 120                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20'))
106                         : ''; 121                         : '';
107                 } 122                 }
108                 paramData[paramName] = paramValue; 123                 paramData[paramName] = paramValue;
109                 if (paramValue === defaultValue) { 124                 if (paramValue === defaultValue) {
110                     delete paramData[paramName]; 125                     delete paramData[paramName];
111                 } 126                 }
112                 paramData = $.param(paramData); 127                 paramData = $.param(paramData);
113                 if (isAjax) { 128                 if (isAjax) {
114                     submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); 129                     submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : ''));
115                 } else location.href = baseUrl + (paramData.length ? '?' + paramData : ''); 130                 } else location.href = baseUrl + (paramData.length ? '?' + paramData : '');
116             } 131             }
117         }, 132         },
118  133 
119         initObserve: function () { 134         initObserve: function () {
120             var self = this; 135             var self = this;
121             var isAjax = this.options.isAjax; 136             var isAjax = this.options.isAjax;
122  137 
123             // fix browser back, forward button 138             // fix browser back, forward button
124             if (typeof window.history.replaceState === "function") { 139             if (typeof window.history.replaceState === "function") {
125                 window.history.replaceState({url: document.URL}, document.title); 140                 window.history.replaceState({url: document.URL}, document.title);
126  141 
127                 setTimeout(function () { 142                 setTimeout(function () {
128                     window.onpopstate = function (e) { 143                     window.onpopstate = function (e) {
129                         if (e.state) { 144                         if (e.state) {
130                             submitFilterAction(e.state.url, 1); 145                             submitFilterAction(e.state.url, 1);
131                         } 146                         }
132                     }; 147                     };
133                 }, 0) 148                 }, 0)
134             } 149             }
135  150 
136             var pageElements = $('#layer-product-list').find('.pages a'); 151             var pageElements = $('#layer-product-list').find('.pages a');
137             pageElements.each(function () { 152             pageElements.each(function () {
138                 var el = $(this), 153                 var el = $(this),
139                     link = self.checkUrl(el.prop('href')); 154                     link = self.checkUrl(el.prop('href'));
140                 if (!link) { 155                 if (!link) {
141                     return; 156                     return;
142                 } 157                 }
143  158 
144                 el.bind('click', function (e) { 159                 el.bind('click', function (e) {
145                     e.stopPropagation(); 160                     e.stopPropagation();
146                     e.preventDefault(); 161                     e.preventDefault();
147                     if (isAjax) { 162                     if (isAjax) {
148                         submitFilterAction(link); 163                         submitFilterAction(link);
149                     } else location.href = link; 164                     } else location.href = link;
150                 }) 165                 })
151             }); 166             });
152  167 
153             var currentElements = this.element.find('.filter-current a, .filter-actions a'); 168             var currentElements = this.element.find('.filter-current a, .filter-actions a');
154             currentElements.each(function (index) { 169             currentElements.each(function (index) {
155                 var el = $(this), 170                 var el = $(this),
156                     link = self.checkUrl(el.prop('href')); 171                     link = self.checkUrl(el.prop('href'));
157                 if (!link) { 172                 if (!link) {
158                     return; 173                     return;
159                 } 174                 }
160  175 
161                 el.bind('click', function (e) { 176                 el.bind('click', function (e) {
162                     e.stopPropagation(); 177                     e.stopPropagation();
163                     e.preventDefault(); 178                     e.preventDefault();
164                     if (isAjax) { 179                     if (isAjax) {
165                         submitFilterAction(link); 180                         submitFilterAction(link);
166                     } else { 181                     } else {
167                         location.href = link; 182                         location.href = link;
168                     } 183                     }
169                 }); 184                 });
170             }); 185             });
171  186 
172             var optionElements = this.element.find('.filter-options a'); 187             var optionElements = this.element.find('.filter-options a');
173             optionElements.each(function (index) { 188             optionElements.each(function (index) {
174                 var el = $(this), 189                 var el = $(this),
175                     link = self.checkUrl(el.prop('href')); 190                     link = self.checkUrl(el.prop('href'));
176                 if (!link) { 191                 if (!link) {
177                     return; 192                     return;
178                 } 193                 }
179  194 
180                 el.bind('click', function (e) { 195                 el.bind('click', function (e) {
181                     if (el.hasClass('swatch-option-link-layered')) { 196                     if (el.hasClass('swatch-option-link-layered')) {
182                         self.selectSwatchOption(el); 197                         self.selectSwatchOption(el);
183                     } else { 198                     } else {
184                         var checkboxEl = el.siblings(self.options.checkboxEl); 199                         var checkboxEl = el.siblings(self.options.checkboxEl);
185                         checkboxEl.prop('checked', !checkboxEl.prop('checked')); 200                         checkboxEl.prop('checked', !checkboxEl.prop('checked'));
186                     } 201                     }
187  202 
188                     e.stopPropagation(); 203                     e.stopPropagation();
189                     e.preventDefault(); 204                     e.preventDefault();
190                     self.ajaxSubmit(link); 205                     self.ajaxSubmit(link);
191                 }); 206                 });
192  207 
193                 var checkbox = el.siblings(self.options.checkboxEl); 208                 var checkbox = el.siblings(self.options.checkboxEl);
194                 checkbox.bind('click', function (e) { 209                 checkbox.bind('click', function (e) {
195                     e.stopPropagation(); 210                     e.stopPropagation();
196                     self.ajaxSubmit(link); 211                     self.ajaxSubmit(link);
197                 }); 212                 });
198             }); 213             });
199  214 
200             var swatchElements = this.element.find('.swatch-attribute'); 215             var swatchElements = this.element.find('.swatch-attribute');
201             swatchElements.each(function (index) { 216             swatchElements.each(function (index) {
202                 var el = $(this); 217                 var el = $(this);
203                 var attCode = el.attr('attribute-code'); 218                 var attCode = el.attr('attribute-code');
204                 if (attCode) { 219                 if (attCode) {
205                     if (self.options.params.hasOwnProperty(attCode)) { 220                     if (self.options.params.hasOwnProperty(attCode)) {
206                         var attValues = self.options.params[attCode].split(","); 221                         var attValues = self.options.params[attCode].split(",");
207                         var swatchOptions = el.find('.swatch-option'); 222                         var swatchOptions = el.find('.swatch-option');
208                         swatchOptions.each(function (option) { 223                         swatchOptions.each(function (option) {
209                             var elOption = $(this); 224                             var elOption = $(this);
210                             if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { 225                             if ($.inArray(elOption.attr('option-id'), attValues) !== -1) {
211                                 elOption.addClass('selected'); 226                                 elOption.addClass('selected');
212                             } 227                             }
213                         }); 228                         });
214                     } 229                     }
215                 } 230                 }
216             }); 231             });
217         }, 232         },
218  233 
219         selectSwatchOption: function (el) { 234         selectSwatchOption: function (el) {
220             var childEl = el.find('.swatch-option'); 235             var childEl = el.find('.swatch-option');
221             if (childEl.hasClass('selected')) { 236             if (childEl.hasClass('selected')) {
222                 childEl.removeClass('selected'); 237                 childEl.removeClass('selected');
223             } else { 238             } else {
224                 childEl.addClass('selected'); 239                 childEl.addClass('selected');
225             } 240             }
226         }, 241         },
227  242 
228         initSlider: function () { 243         initSlider: function () {
229             var self = this, 244             var self = this,
230                 slider = this.options.slider; 245                 slider = this.options.slider;
231  246 
232             for (var code in slider) { 247             for (var code in slider) {
233                 if (slider.hasOwnProperty(code)) { 248                 if (slider.hasOwnProperty(code)) {
234                     var sliderConfig = slider[code], 249                     var sliderConfig = slider[code],
235                         sliderElement = self.element.find(this.options.sliderElementPrefix + code), 250                         sliderElement = self.element.find(this.options.sliderElementPrefix + code),
236                         priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null; 251                         priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null;
237  252 
238                     if (sliderElement.length) { 253                     if (sliderElement.length) {
239                         sliderElement.slider({ 254                         sliderElement.slider({
240                             range: true, 255                             range: true,
241                             min: sliderConfig.minValue, 256                             min: sliderConfig.minValue,
242                             max: sliderConfig.maxValue, 257                             max: sliderConfig.maxValue,
243                             values: [sliderConfig.selectedFrom, sliderConfig.selectedTo], 258                             values: [sliderConfig.selectedFrom, sliderConfig.selectedTo],
244                             slide: function (event, ui) { 259                             slide: function (event, ui) {
245                                 self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat); 260                                 self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat);
246                             }, 261                             },
247                             change: function (event, ui) { 262                             change: function (event, ui) {
248                                 self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1])); 263                                 self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1]));
249                             } 264                             }
250                         }); 265                         });
251                     } 266                     }
252                     self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat); 267                     self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat);
253                 } 268                 }
254             } 269             }
255         }, 270         },
256  271 
257         displaySliderText: function (code, from, to, format) { 272         displaySliderText: function (code, from, to, format) {
258             var textElement = this.element.find(this.options.sliderTextElementPrefix + code); 273             var textElement = this.element.find(this.options.sliderTextElementPrefix + code);
259             if (textElement.length) { 274             if (textElement.length) {
260                 if (format !== null) { 275                 if (format !== null) {
261                     from = this.formatPrice(from, format); 276                     from = this.formatPrice(from, format);
262                     to = this.formatPrice(to, format); 277                     to = this.formatPrice(to, format);
263                 } 278                 }
264  279 
265                 textElement.html(from + ' - ' + to); 280                 textElement.html(from + ' - ' + to);
266             } 281             }
267         }, 282         },
268  283 
269         getSliderUrl: function (url, from, to) { 284         getSliderUrl: function (url, from, to) {
270             return url.replace('from-to', from + '-' + to); 285             return url.replace('from-to', from + '-' + to);
271         }, 286         },
272  287 
273         formatPrice: function (value, format) { 288         formatPrice: function (value, format) {
274             return ultil.formatPrice(value, format); 289             return ultil.formatPrice(value, format);
275         }, 290         },
276  291 
277         ajaxSubmit: function (submitUrl) { 292         ajaxSubmit: function (submitUrl) {
278             var isAjax = this.options.isAjax; 293             var isAjax = this.options.isAjax;
279             this.element.find(this.options.mobileShopbyElement).trigger('click'); 294             this.element.find(this.options.mobileShopbyElement).trigger('click');
280  295 
281             if (isAjax) { 296             if (isAjax) {
282                 return submitFilterAction(submitUrl); 297                 return submitFilterAction(submitUrl);
283             } 298             }
284             location.href = submitUrl; 299             location.href = submitUrl;
285         }, 300         },
286  301 
287         checkUrl: function (url) { 302         checkUrl: function (url) {
288             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; 303             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
289  304 
290             return regex.test(url) ? url : null; 305             return regex.test(url) ? url : null;
291         }, 306         },
292  307 
293         //Handling 'add to wishlist' & 'add to compare' event 308         //Handling 'add to wishlist' & 'add to compare' event
294         initWishlistCompare: function () { 309         initWishlistCompare: function () {
295             var isAjax = this.options.isAjax; 310             var isAjax = this.options.isAjax;
296             var isCustomerLoggedIn = this.options.isCustomerLoggedIn, 311             var isCustomerLoggedIn = this.options.isCustomerLoggedIn,
297                 elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); 312                 elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : '');
298             $(elClass).each(function () { 313             $(elClass).each(function () {
299                 var el = $(this); 314                 var el = $(this);
300                 if (isAjax){ 315                 if (isAjax){
301                     $(el).bind('click', function (e) { 316                     $(el).bind('click', function (e) {
302                         var dataPost = $(el).data('post'), 317                         var dataPost = $(el).data('post'),
303                             formKey = $('input[name="form_key"]').val(), method = 'post'; 318                             formKey = $('input[name="form_key"]').val(), method = 'post';
304                         if (formKey) { 319                         if (formKey) {
305                             dataPost.data.form_key = formKey; 320                             dataPost.data.form_key = formKey;
306                         } 321                         }
307  322 
308                         var paramData = $.param(dataPost.data), 323                         var paramData = $.param(dataPost.data),
309                             url = dataPost.action + (paramData.length ? '?' + paramData : ''); 324                             url = dataPost.action + (paramData.length ? '?' + paramData : '');
310  325 
311                         e.stopPropagation(); 326                         e.stopPropagation();
312                         e.preventDefault(); 327                         e.preventDefault();
313  328 
314                         if (el.hasClass('towishlist')) { 329                         if (el.hasClass('towishlist')) {
315                             submitFilterAction(url, true, method); 330                             submitFilterAction(url, true, method);
316                         } else{ 331                         } else{
317                             submitFilterAction(url, true, method); 332                             submitFilterAction(url, true, method);
318                         } 333                         }
319                     }); 334                     });
320                 } 335                 }
321             }) 336             })
322         }, 337         },
323  338 
324         //Selected attribute color after page load. 339         //Selected attribute color after page load.
325         selectedAttr: function () { 340         selectedAttr: function () {
326             var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value'); 341             var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value');
327  342 
328             filterCurrent.each(function(){ 343             filterCurrent.each(function(){
329                 var el         = $(this), 344                 var el         = $(this),
330                     colorLabel = el.html(), 345                     colorLabel = el.html(),
331                     swatchAttr  = $('.filter-options .filter-options-item .swatch-option-link-layered .swatch-option'); 346                     swatchAttr  = $('.filter-options .filter-options-item .swatch-option-link-layered .swatch-option');
332  347 
333                 swatchAttr.each(function(){ 348                 swatchAttr.each(function(){
334                     var elA = $(this); 349                     var elA = $(this);
335                     if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){ 350                     if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){
336                         elA.addClass('selected'); 351                         elA.addClass('selected');
337                     } 352                     }
338                 }); 353                 });
339             }); 354             });
340         }, 355         },
341  356 
342         renderCategoryTree: function () { 357         renderCategoryTree: function () {
343             var iconExpand = this.element.find('.filter-options .icon-expand'); 358             var iconExpand = this.element.find('.filter-options .icon-expand');
344  359 
345             iconExpand.each(function () { 360             iconExpand.each(function () {
346                 var el = $(this); 361                 var el = $(this);
347  362 
348                 el.nextAll('ol').each(function() { 363                 el.nextAll('ol').each(function() {
349                     if($(this).find('input[checked]').length !== 0 364                     if($(this).find('input[checked]').length !== 0
350                         && !$(this).prevAll('.icon-expand').hasClass('active') 365                         && !$(this).prevAll('.icon-expand').hasClass('active')
351                     ) { 366                     ) {
352                         $(this).show(); 367                         $(this).show();
353                         $(this).prevAll('.icon-expand').toggleClass('active'); 368                         $(this).prevAll('.icon-expand').toggleClass('active');
354                     } 369                     }
355                 }); 370                 });
356  371 
357                 el.bind('click', function (e) { 372                 el.bind('click', function (e) {
358                     el.nextAll('ol').toggle(); 373                     el.nextAll('ol').toggle();
359                     el.toggleClass('active'); 374                     el.toggleClass('active');
360                     e.stopPropagation(); 375                     e.stopPropagation();
361                 }); 376                 });
362             }); 377             });
363         } 378         }
364     }); 379     });
365  380 
366     return $.mageplaza.layer; 381     return $.mageplaza.layer;
367 }); 382 });